package lista;

import br.edu.fvs.principal.R;
import android.app.ListActivity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.widget.ListAdapter;
import android.widget.SimpleCursorAdapter;


public class ExemploListaContatos extends ListActivity {
  private ListAdapter adaptador;
  public void onCreate(Bundle icicle){
	  super.onCreate(icicle);
	  Uri uri = ContactsContract.Contacts.CONTENT_URI;
	  Cursor c = getContentResolver().query(uri, null, null, null, null);
	  startManagingCursor(c);
	  String[] colunas = new String[]
			  {ContactsContract.Contacts.DISPLAY_NAME};
	  int[] campos = new int[] {R.id.nome};
	  adaptador = new SimpleCursorAdapter(this, R.layout.layout_contatos, c, colunas, campos);
	  setListAdapter(adaptador);	
	  
  }
}
